home *** CD-ROM | disk | FTP | other *** search
- property spriteNum, card, motion, location
- global reserve, stock, getlist, equal, currentsel, godlist, foundation, tableau, points
-
- on beginSprite me
- card = sprite(spriteNum)
- card.member = member(stock.cards[1].rank & "_" & stock.cards[1].suit, "playing cards")
- stock.cards.deleteAt(1)
- reserve.addCard(spriteNum)
- location = card.loc
- end
-
- on mouseDown me
- if card.member.name <> "empty" then
- puppetSound(3, member("pick card", "100GPak Generic SFX"))
- if spriteNum = reserve.getlastcard().spnum then
- getlist = reserve
- motion = timeout(string(spriteNum)).new(5, #movement, me)
- else
- end if
- else
- if card.member.name = "empty" then
- sendSprite(spriteNum - 1, #mouseDown)
- end if
- end if
- end
-
- on movement
- if the mouseDown then
- card.locZ = spriteNum + 1000
- card.loc = the mouseLoc
- else
- if the mouseUp then
- motion.forget()
- card.locZ = spriteNum
- card.loc = location
- end if
- end if
- end
-
- on mouseUp me
- if equal then
- puppetSound(3, member("pick card", "100GPak Generic SFX"))
- sprite(currentsel).member = member(sprite(spriteNum).member.name, "playing cards")
- godlist.addCard(currentsel)
- sprite(spriteNum).loc = location
- reserve.cards.deleteOne(reserve.getlastcard())
- sprite(spriteNum).member = member("empty", "playing cards")
- equal = 0
- if objectp(foundation[sprite(currentsel).row]) then
- points = points + 10
- end if
- if objectp(tableau[sprite(currentsel).row]) then
- repeat with i = 93 to 96
- if tableau[sprite(i).row].getcardcount() = 0 then
- next repeat
- end if
- sprite(i).loc = tableau[sprite(i).row].getlastcard().location
- end repeat
- end if
- currentsel = 0
- godlist = VOID
- getlist = VOID
- checkwin()
- else
- if not equal then
- puppetSound(3, member("drop card", "100GPak Generic SFX"))
- getlist = VOID
- sprite(spriteNum).loc = location
- end if
- end if
- checkwin()
- end
-